package com.secfound.soccer.shared.db;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Mock class for testing
 * @author alfonso.ayala
 *
 */
public class GameDaoMock implements GameDao{

		Map<String, Game> map = new LinkedHashMap<String, Game>();
		
		{
			map.put("colombia-holanda", new Game( 
	                                 "colombia","1", "holanda","2","2013-10-30 16:50:00","Final","Durban",""));
			
		}
		
		public void add(Game game) {
			String email = game.getaTeam() +"-"+ game.getbTeam();
			map.put(email, game);
		}

		public List<Game> list() {
			return Collections.unmodifiableList(new ArrayList<Game>(map.values()));
		}

		public void remove(Game game) {
			map.remove( game.getaTeam() +"-"+ game.getbTeam()   );
		}

		public void update(Game game) {		
			map.put(game.getaTeam() +"-"+ game.getbTeam(), game);
		}

	
}
